package main.chapter6.interfaces;/**
 * @Author xy
 * @Date 2020/6/20 22:42
 * @Description
 */

/**
 * 文件名称： main.chapter6.interfaces.Employee.java</br>
 * 初始作者： xy</br>
 * 创建日期： 2020/6/20 22:42</br>
 * 功能说明： TODO <br/>
 * =================================================<br/>
 * 修改记录：<br/>
 * 修改作者        日期       修改内容<br/>
 * ================================================<br/>
 * Copyright (c) 2020-2021 .All rights reserved.<br/>
 */
public class Employee implements Comparable<Employee> {
    private String name;

    private double salary;

    public Employee(String name, double salary) {
        this.name = name;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }

    public void raiseSalary(double byPercent){
        double raise = salary*byPercent/100;
        salary+=raise;
    }

    @Override
    public int compareTo(Employee o) {
        return Double.compare(salary,o.salary);
    }
}
